package org.xiaojinlong.generic;

import java.util.ArrayList;

/**
 * @author Jin Long
 *         2016/6/27
 */
public class GenericArray<T> {
    private T[] array;

    public GenericArray(int size) {
        array = (T[]) new Object[size];
    }

    public void put(int index, T item) {
        array[index] = item;
    }

    public T get(int index) {
        return array[index];
    }

    // Method that exposes the underlying representation
    public T[] rep() {
        return array;
    }

    public static void main(String[] args) {
        GenericArray<Integer> array = new GenericArray<>(10);
//        Integer[] rep = array.rep();
        Object[] objRep = array.rep();
        ArrayList<Integer> lst;
    }
}
